﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CubicFWNet.Data.Models;
using CubicFWNet.Data.SystemManager;
using CubicFWNet.Data.ViewModal;

namespace CubicFWNet.Application.SystemManager
{
    public class FinanceInvoiceApp
    {
        private FinanceInvoiceRepository _service = new FinanceInvoiceRepository();

        public int Add(FinanceInvoice web)
        {
            return _service.Insert(web);
        }

        public int Update(FinanceInvoice web)
        {
            return _service.Update(web);
        }

        public FinanceInvoice GetSingleFinanceInvoice(Guid id)
        {
            return _service.FindEntity(a => a.Id == id);
        }

        public IQueryable<FinanceInvoice> GetFinanceInvoiceListByoId(Guid orderId)
        {
            return _service.IQueryable(a => a.OrderId == orderId).OrderByDescending(a => a.ApplyTime);
        }

        public IEnumerable<InvoiceView> GetFinanceInvoicesList(int status, string orderNumber)
        {
            return _service.GetFinanceInvoicesList(status, orderNumber).OrderByDescending(a => a.OwnTime);
        }
    }
}
